package com.basin.common.mybatisplus.base;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Setter;

/**
 * @author: Sam ZHONG | sammy1997@aliyun.com
 * @date: 2025/3/23 19:57
 * @description:
 */
@Setter
public class BasePage {
    @Schema(description = "当前页码")
    private Integer current;

    @Schema(description = "当前容量")
    private Integer size;

    public Integer getCurrent() {
        if (current == null || current <= 0) {
            return 1;
        }
        return current;
    }

    public Integer getSize() {
        if (size == null || size <= 0) {
            return 10;
        }
        return Math.min(2000, size);
    }
}
